package com.spzx.product.api;

import com.spzx.common.core.constant.SecurityConstants;
import com.spzx.common.core.constant.ServiceNameConstants;
import com.spzx.common.core.domain.R;
import com.spzx.common.core.web.domain.AjaxResult;
import com.spzx.product.api.factory.RemoteProductServiceFallbackFactory;
import com.spzx.product.api.vo.ProductSkuVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;

import java.util.List;

/**
 * @author XC
 * @version 1.0
 * @description
 * @knowledge
 * 所有的 FeignClient的接口名都是 value的名字，故会存在多个同名 FeignClient接口，为避免报错：
 * 1. 需要在配置文件中配置：spring: main: allow-bean-definition-overriding: true
 * 2. 配置各 FeignClient接口的 contextId值
 */
@FeignClient(
        contextId = "remoteBrandService",
        value = ServiceNameConstants.PRODUCT_SERVICE  // 微服务名字
        // fallbackFactory = RemoteBrandServiceFallbackFactory.class  // 降级工厂类
)
public interface RemoteBrandService {
    @Operation(summary = "测试")
    @GetMapping("/brand/test")
    AjaxResult test(
            @Parameter(description = "source")
            @RequestHeader(SecurityConstants.FROM_SOURCE) String source
    );
}
